<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<img id="light" src="img/off.gif">
		<script>
			i = 0;
			var light = document.getElementById('light');
			src1 = "img/off.gif";
			src2 = "img/on.gif";
			light.onclick = fun;

			function fun() {
				if (i % 2 == 0) {
					light.src = src2;
					i++;
				} else {
					light.src = src1;
					i--;
				}
			}
		</script>
	</body>
</html>
